package org.summer.lawyer.controller.admin;

import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.dromara.sms4j.api.SmsBlend;
import org.dromara.sms4j.api.entity.SmsResponse;
import org.dromara.sms4j.core.factory.SmsFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.summer.common.core.domain.R;
import org.summer.lawyer.constant.SmsConstants;

import java.util.LinkedHashMap;

/**
 * 短信测试
 */
@Tag(name = "后台相关接口",description = "短信发送测试")
@SaIgnore
@RequiredArgsConstructor
@RestController
@RequestMapping("/sms")
public class SmsController {


    @GetMapping("/tp1")
    public R<SmsResponse> sendMsg(String phone){
        LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
        map.put("name", "刘先生");
        SmsBlend smsBlend = SmsFactory.getSmsBlend("config1");
        SmsResponse smsResponse = smsBlend.sendMessage(phone, "SMS_469015588", map);
        return R.ok(smsResponse);
    }
}
